package com.tyk.bookstore.front.product.model.vo;


import com.tyk.bookstore.front.common.core.util.FileUtil;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author tyk
 * @description 书籍
 */
@Data
public class BookVo {

    @Schema(description = "ID")
    private String id;

    @Schema(description = "标题")
    private String title;

    @Schema(description = "简介")
    private String summary;

    @Schema(description = "价格")
    private BigDecimal price;

    @Schema(description = "封面路径")
    private String cover;

    @Schema(description = "书名")
    private String name;

    @Schema(description = "作者ID")
    private Long authorId;

    @Schema(description = "作者名字")
    private String authorName;

    @Schema(description = "ISBN")
    private String isbn;

    @Schema(description = "出版社ID")
    private Long publisherId;

    @Schema(description = "出版社名字")
    private String publisherName;

    @Schema(description = "出版时间")
    private LocalDateTime publishTime;

    @Schema(description = "低级分类ID")
    private Long classificationId;

    @Schema(description = "分类全称")
    private String classificationName;

    @Schema(description = "分类集合[一级+二级+三级]")
    private List<ClazzNameVo> classificationNameList;

    @Schema(description = "字数[单位：千字]")
    private Long wordNum;

    @Schema(description = "重量（单位：克）")
    private Long weight;

    @Schema(description = "规格")
    private Integer format;

    @Schema(description = "销量")
    private Long saleNum;

    @Schema(description = "付款人数")
    private Long payNum;

    @Schema(description = "评论人数")
    private Long commentNum;

    @Schema(description = "收藏人数")
    private Long collectNum;

    @Schema(description = "点赞人数")
    private Long likeNum;

    @Schema(description = "书籍展示图片")
    private List<String> imgList;

    @Schema(description = "是否收藏")
    private Boolean collected;

    @Schema(description = "是否点赞")
    private Boolean praised;


    public BookVo setCover(String cover) {
        this.cover = FileUtil.fullFilePath(cover);
        return this;
    }
}
